package edu.zut.software.identity.Repository;


import edu.zut.software.identity.domain.StuGrade;
import edu.zut.software.identity.domain.StuMajor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StuGradeRepository extends JpaRepository<StuGrade,Object>, JpaSpecificationExecutor<StuGrade> {
   @Query(value = "select stu_grade.id,stu_grade.name,stu_grade.college_id,stu_grade.college_name,stu_grade.major_id,stu_grade.major_name,stu_grade.px,stu_grade.wx_id\n" +
           "    from stu_grade\n" +
           "    left join stu_major major on stu_grade.name = major.name\n" +
           "where major_id=?1",
           nativeQuery = true)
    List<StuGrade> getGradeInfoByMajorId(@Param("Id") String Id);

}
